/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.robomind.pantallas;

import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.view.View;
import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
import android.media.MediaPlayer;
import android.net.Uri;
/**
 *
 * @author CarlosAndre
 */
public class Principal extends Activity {

    /** Called when the activity is first created. */
    private Context pContext;
    private SoundPool sndPool;
    private float rate = 1.0f;
    private float masterVolume = 1.0f;
    private float leftVolume = 1.0f;
    private float rightVolume = 1.0f;
    private float balance = 0.5f;
    private boolean editar=false;
    MediaPlayer mp;
    int posActual=0;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        
        super.onCreate(savedInstanceState);
        setContentView(R.layout.nuevo);
        mp = new MediaPlayer();
        mp = MediaPlayer.create(getApplicationContext(), R.raw.otravez);
        mp.seekTo(posActual);
        mp.start();
        View editar = findViewById(R.id.widget34);
        editar.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_editor();
            }
        });
        View ver = findViewById(R.id.widget35);
        ver.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_ver();
            }
        });
        View correr = findViewById(R.id.widget36);
        correr.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_correr();
            }
        });
        View opciones = findViewById(R.id.widget37);
        opciones.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_opciones();
            }
        });
        View salir = findViewById(R.id.widget39);
        salir.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_salir();
            }
        });
        
        // ToDo add your GUI initialization code here        
    }
    public void Menu_editor(){
        setContentView(R.layout.menu_editar);
        View boton1 = findViewById(R.id.widget34);
        boton1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                onCreate(Bundle.EMPTY);
            }
        });
        View ver = findViewById(R.id.widget35);
        ver.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_ver();
            }
        });
        View correr = findViewById(R.id.widget36);
        correr.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_correr();
            }
        });
        View opciones = findViewById(R.id.widget37);
        opciones.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_opciones();
            }
        });
        View salir = findViewById(R.id.widget39);
        salir.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_salir();
                
            }
        });
    }
    public void Menu_ver(){
        setContentView(R.layout.menu_ver);
        View boton1 = findViewById(R.id.widget35);
        boton1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                onCreate(Bundle.EMPTY);
            }
        });
        View editar = findViewById(R.id.widget34);
        editar.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_editor();
            }
        });
        View correr = findViewById(R.id.widget36);
        correr.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_correr();
            }
        });
        View opciones = findViewById(R.id.widget37);
        opciones.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_opciones();
            }
        });
        View salir = findViewById(R.id.widget39);
        salir.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_salir();
            }
        });
    }
    public void Menu_correr(){
        setContentView(R.layout.menu_correr);
        View boton1 = findViewById(R.id.widget36);
        boton1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                onCreate(Bundle.EMPTY);
            }
        });
        View editar = findViewById(R.id.widget34);
        editar.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_editor();
            }
        });
        View ver = findViewById(R.id.widget35);
        ver.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_ver();
            }
        });
        View opciones = findViewById(R.id.widget37);
        opciones.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_opciones();
            }
        });
        View salir = findViewById(R.id.widget39);
        salir.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_salir();
            }
        });
    }
    public void Menu_opciones(){
        setContentView(R.layout.menu_opciones);
        View boton1 = findViewById(R.id.widget37);
        boton1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                onCreate(Bundle.EMPTY);
            }
        });
        View editar = findViewById(R.id.widget34);
        editar.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_editor();
            }
        });
        View ver = findViewById(R.id.widget35);
        ver.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_ver();
            }
        });
        View correr = findViewById(R.id.widget36);
        correr.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_correr();
            }
        });
        View salir = findViewById(R.id.widget39);
        salir.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                Menu_salir();
            }
        });
        View play = findViewById(R.id.widget47);
        play.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                mp.seekTo(posActual);
                mp.start();
            }
        });
        View pause = findViewById(R.id.widget49);
        pause.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                posActual = mp.getCurrentPosition();
                mp.pause();
            }
        });
        View stop = findViewById(R.id.widget50);
        stop.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
                posActual = 0;
                mp.stop();
            }
        });
    }
    public void Menu_salir(){
        
        Principal.super.onDestroy();
        finish();
    }
    
}

